package model.db.table;

import java.util.ArrayList;

/**
 * Author: Raoux Etienne
 * Student login: jc218934
 * Student number: 12448190
 * email: etienne.raoux@my.jcu.edu.au
 * alt email: jc218934@gmail.com
 */
public class BidHistory
{
    private final String imgUrl;
    private final String title;
    private final String itemUrl;
    private final String sellerUrl;

    public ArrayList<Bid> getBidHistory() {
        return bidHistory;
    }

    public String getImgUrl() {
        return imgUrl;
    }

    public String getItemUrl() {
        return itemUrl;
    }

    public String getPrice() {
        return price;
    }

    public String getSellerName() {
        return sellerName;
    }

    public String getSellerUrl() {
        return sellerUrl;
    }

    public String getTitle() {
        return title;
    }
    private final String sellerName;
    private final String price;
    private final ArrayList<Bid> bidHistory;
    public BidHistory(String imgUrl, String title, String itemUrl, String sellerUrl,
            String sellerName, String price, ArrayList<Bid> bidHistory)
    {
        this.imgUrl = imgUrl;
        this.title = title;
        this.itemUrl = itemUrl;
        this.sellerUrl = sellerUrl;
        this.sellerName = sellerName;
        this.price = price;
        this.bidHistory = bidHistory;

    }

    public void insertInDb()
    {
        System.out.println(this);
    }

    public String toString()
    {
        String str = "BidHistory: \n"
                + "imageUrl = "+imgUrl+"\n"
                + "title = "+title+"\n"
                + "description url = "+itemUrl+"\n"
                + "seller = "+sellerName+"\n"
                + "sellerUrl = "+sellerUrl+"\n"
                + "Current highest bid = "+price+"\n";
        if (bidHistory.size() >0)
        {
            str += "Bid history\n";
            for (Bid bid:bidHistory)
            {
                str += bid.toString();
            }
        }
        return str;
    }
}
